package com.hsy.sunflowerbao.home.store

import com.flux.action.RxAction
import com.flux.action.RxStoreChange
import com.flux.dispatcher.Dispatcher
import com.hsy.sunflowerbao.base.action.ActionType
import com.hsy.sunflowerbao.base.action.Key
import com.hsy.sunflowerbao.base.data.TagData
import com.hsy.sunflowerbao.base.store.BaseStore

/**
 * Created on 2018/4/11.
 *
 * @author Yang
 */
class ScoreStore(dispatcher: Dispatcher) : BaseStore(dispatcher) {
    /**
     * 用户信息
     */
    lateinit var tags: List<TagData>

    override fun onRxAction(action: RxAction) {
        if (handleSuper) super.onRxAction(action)
        when (action.type) {
            ActionType.GET_TAGS -> if (action.success) tags = action[Key.TAG_DATA]
            ActionType.SEND_SCORE -> { }
            else -> return
        }
        postChange(RxStoreChange(tag, action.type, action.success))
    }
}